<?php
/* -----------------------------------------------------------------
 * 	$Id: attribut_manager.php 562 2013-08-19 21:40:33Z akausch $
 * 	Copyright (c) 2011-2021 commerce:SEO by Webdesign Erfurt
 * 	http://www.commerce-seo.de
 * ------------------------------------------------------------------
 * 	based on:
 * 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
 * 	(c) 2002-2003 osCommerce - www.oscommerce.com
 * 	(c) 2003     nextcommerce - www.nextcommerce.org
 * 	(c) 2005     xt:Commerce - www.xt-commerce.com
 * 	Released under the GNU General Public License
 * --------------------------------------------------------------- */
defined("_VALID_XTC") or die("Direct access to this location isn't allowed.");
if ($pInfo->products_id != '') {
    ?>
    <table width="100%">
        <tr>
            <td width="50%">
                <button type="button" class="button" onclick="dialogBox('xajax_dispatcher.php?modul=attr_manager&do=new_attribut&pid=<?php echo $pInfo->products_id; ?>', 300, 150, 'Attribut anlegen')">
                    Attribut einfügen
                </button>
                <button type="button" class="button" onclick="dialogBox('xajax_dispatcher.php?modul=attr_manager&do=new_option', 500, 450, 'Option anlegen')">
                    Option anlegen
                </button>
                <button type="button" class="button" onclick="dialogBox('xajax_dispatcher.php?modul=attr_manager&do=new_value', 500, 450, 'Optionswert anlegen')">
                    Optionswert anlegen
                </button>
            </td>
            <td align="right">
                <button type="button" class="button" onclick="dialogBox('xajax_dispatcher.php?modul=attr_manager&do=save_profile&pid=<?php echo $pInfo->products_id; ?>', 300, 150, 'Als Vorlage speichern')">
                    Vorlage speichern
                </button>
                <button type="button" class="button" onclick="dialogBox('xajax_dispatcher.php?modul=attr_manager&do=load_profile&pid=<?php echo $pInfo->products_id; ?>', 300, 150, 'Vorlage laden')">
                    Vorlage laden
                </button>
                <button type="button" class="button" onclick="dialogBox('xajax_dispatcher.php?modul=attr_manager&do=delete_profile&pid=<?php echo $pInfo->products_id; ?>', 300, 150, 'Vorlage löschen')">
                    Vorlage löschen
                </button>
            </td>
        </tr>
    </table>
<?php } ?>
<div id="attributes"></div>

<script type="text/javascript">
function dialogBox(url, w, h, title, save) {
	if (save == 'true') {
		var extra_button = {"<?php echo BUTTON_SAVE ?>": function() {
				$("#dialog_form").submit();
			}, "<?php echo BUTTON_CANCEL ?>": function() {
				$(this).dialog("close");
			}};
	} else {
		var extra_button = '';
	}

	var dialog = $('<div class="dialog-box" style="display:none" class="loading"></div>').appendTo('body');

	dialog.dialog({
		close: function(event, ui) {
			dialog.remove();
		},
		modal: true,
		title: title,
		buttons: extra_button,
		width: w > 0 ? w : 500,
		height: h > 0 ? h : 450
	});
	dialog.load(url, {}, function(responseText, textStatus, XMLHttpRequest) {
		dialog.removeClass('loading');
		$('.ui-dialog-content').css({backgroundImage: 'none'});
	});
	return false;
}
</script>
